package com.emily.test.service.impl;

import com.emily.test.mapper.TRoleResourceMapper;
import com.emily.test.model.TResource;
import com.emily.test.model.TRoleResource;
import com.emily.test.service.TRoleResourceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service(value = "TRoleResourceServiceAgent")
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
public class TRoleResourceServiceImpl implements TRoleResourceService {

    private Logger logger = LoggerFactory.getLogger(TRoleResourceServiceImpl.class);

    @Resource
    private TRoleResourceMapper tRoleResourceMapper;

    @Override
    public int insertTRoleResourceInfo(Map<String, Object> map) {
         return tRoleResourceMapper.insertRoleResource(map);
    }

    @Override
    public int deleteTRoleResourceByRoleId(int roleId) {
        return tRoleResourceMapper.deleteTRoleResourceByRoleId(roleId);
    }

    @Override
    public List<TRoleResource> selectTReSourceIDListByRoleId(Integer roleId) {
        return tRoleResourceMapper.selectTReSourceIDListByRoleId(roleId);
    }

    @Override
    public int deleteTRoleResourceByRoleIds(List<Integer> tRoleIds) {
        return tRoleResourceMapper.deleteTRoleResourceByRoleIds(tRoleIds);
    }

}
